package methodOverLoading;


public class AreaCalculator {

	/**
	 * The purpose of the program is  to see how the method overloading taking the same method name. 
	 * Calculating the area of square,rectangle,triangle  based on the parameters passing from the caller.
	 */
	
		
	 // the purpose of this method is to  Calculate the area of square.
	 	 
			
		    double area(double lengthOfSide)
		 
		  {
			System.out.println("lengthOfSide"+ lengthOfSide);
			
			double areaOfSquare = (lengthOfSide * lengthOfSide);
			
			System.out.println("areaOfSquare"+ areaOfSquare);
			
			 return areaOfSquare;
		 }
		
		
		// the purpose of this method is to  Calculate the area of rectangle and the method name is area with different method signature .
		
		
		double area(double height,double width)
		{
			System.out.println("height,  Width:  "+ height +"  "+width);
			double areaOfRectangle= (height * width);
			System.out.println("area Of Rectangle :"+ areaOfRectangle);
			return areaOfRectangle;
			
		}
		
		// the purpose of this method is to  Calculate the area of triangle.
		
		
		double areaTriangle(double base,double length)
		{ 
			System.out.println("Base,  length:  "+ base +"  "+length);
			double areaOfTriangle= (base * length)/2;
			System.out.println("area Of triangle :"+areaOfTriangle);
			return areaOfTriangle;
		}
		
		// the purpose of this method is to  Calculate the area of Trapezoid and the method name is area with different method signature .
		
		
		double area(double lenghtOfOneSide ,double lengthOfOtherSide,double height)
		{
			System.out.println("lenghtOfOneSide, lengthOfOtherSide, height = " + lenghtOfOneSide+" , "+ lengthOfOtherSide+" , "+ height);
			double areaOfTrapezoid= (lenghtOfOneSide + lengthOfOtherSide)* height;
			System.out.println("area Of trapezoid :"+ areaOfTrapezoid);
			
			return areaOfTrapezoid;
		}
		

	}


